#include "qlabelhost.h"

#include "qabstractproperty.h"
#include "qpropertyfactory.h"

using namespace SHAREDLIB;

QLabelHost::QLabelHost(QObject *object):
    QFrameHost(object)
{
    QAbstractProperty *pro;

    pro=QPropertyFactory::createProperty("String");
    if(pro!=NULL)
    {
        pro->setAttribute("name","text");
        pro->setAttribute("property_name",tr("Text"));
        pro->setAttribute("group","Attributes");
        addProperty(pro);
    }

    pro=QPropertyFactory::createProperty("Bool");
    if(pro!=NULL)
    {
        pro->setAttribute("name","wordWrap");
        pro->setAttribute("property_name",tr("WordWrap"));
        pro->setAttribute("group","Attributes");
        addProperty(pro);
    }

    pro=QPropertyFactory::createProperty("Align");
    if(pro!=NULL)
    {
        pro->setAttribute("name","alignment");
        pro->setAttribute("property_name",tr("Alignment"));
        pro->setAttribute("group","Attributes");
        addProperty(pro);
    }

    appendMemery("text");
}

void QLabelHost::setText(const QString &text)
{
    setPropertyValue("text",text);
}

QString QLabelHost::text()
{
    return getPropertyValue("text").toString();
}

void QLabelHost::setWordWrap(bool wordWrap)
{
    setPropertyValue("wordWrap",wordWrap);
}

bool QLabelHost::wordWrap()
{
    return getPropertyValue("wordWrap").toBool();
}

void QLabelHost::setAlignment(int alignment)
{
    setPropertyValue("alignment",(Qt::AlignmentFlag)alignment);
}

int QLabelHost::alignment()
{
    return getPropertyValue("alignment").toInt();
}
